package problem_everyday;

public class D2025_07_03_P3304 {
    public char kthCharacter(int k) {
        StringBuilder builder = new StringBuilder();
        builder.append("a");
        int length;
        while(builder.length()<k){
            length = builder.length();
            if(length >= 2){
                builder.append(builder.substring(builder.length()/2, builder.length()));
                for(int i=length/2; i<length; i++){
                    char c =(char) (builder.charAt(i) + 1);
                    if(c>'z') c = 'a';
                    builder.append(c);
                }
            } else {
                builder.append("b");
            }
        }
        return builder.charAt(k-1);
    }

    public static void main(String[] args){
        D2025_07_03_P3304 p = new D2025_07_03_P3304();
        System.out.println(p.kthCharacter(5));
    }
}
